package com.sky.converter;

import com.sky.dto.DishDTO;
import com.sky.entity.Dish;
import com.sky.vo.DishVO;

public class DishConverter {
    /**
     * DishDto对象转Dish对象
     * @param dishDTO
     * @return
     */
    public static Dish DishDtoconvertDish(DishDTO dishDTO) {
        Dish result = new Dish();
        result.setName(dishDTO.getName());
        result.setCategoryId(dishDTO.getCategoryId());
        result.setPrice(dishDTO.getPrice());
        result.setImage(dishDTO.getImage());
        result.setDescription(dishDTO.getDescription());
        return result;
    }
    public static DishVO DishconvertDishVO(Dish dish) {
        DishVO result = new DishVO();
        result.setId(dish.getId());
        result.setName(dish.getName());
        result.setCategoryId(dish.getCategoryId());
        result.setPrice(dish.getPrice());
        result.setImage(dish.getImage());
        result.setDescription(dish.getDescription());
        result.setStatus(dish.getStatus());
        result.setUpdateTime(dish.getUpdateTime());
        return result;
    }
}
